<?php
	//这是前台首页的控制器文件
	class IndexAction extends Action{
			public function index()
			{
				/*
				$data = M('post');
				$result = $data->select($data);
				p($result);
				*/
				$wish = M('post');
				$wishdata = $wish->select();
				$this->assign('wish',$wishdata);
				$this->display();
			}
			
			//异步发布处理
			public function handle()
			{
				
				if(IS_AJAX)
				{
					$ajax = M('post');
					$data = array('username' => I('username'), 'content' => I('content'), 'time' => time());
					$result = $ajax->add($data);
					if($result > 0)
					{
						$data['content'] = replace_phiz($data['content']);
						$data['time'] = date('y-m-d H:i',$data['time']);
						$data['status'] = 1;
						$this->ajaxReturn($data,'json');
					}
					else
					{
						$this->ajaxReturn(array('status' => '0'),'json');
					}
					
					
										
					/*
					$str = '<?php return  '.var_export($phiz,true).';?>';
					 file_put_contents('./data/phiz.php',$str);
					
					$phiz = include ('./data/phiz.php');
					p($phiz);   */
					
					
					
					
				
				}
				else
				{
					_404('非法操作') ;
				}
			}
		}
?>